package me.magicall.db.sql;

/**
 * 使用一个二元操作符连接的两个元素
 * 
 * @author MaGiCalL
 * @param <T>
 * @param <O>
 */
public class TwoElementOperation<T extends Operatable, O extends Operator<T>> extends SqlElementTemplate {

	private T firstArg;
	private O operator;
	private T secondArg;

	public TwoElementOperation() {
		super();
	}

	public TwoElementOperation(final T firstArg, final O operator, final T secondArg) {
		super();
		this.firstArg = firstArg;
		this.operator = operator;
		this.secondArg = secondArg;
	}

	@Override
	public StringBuilder appendTo(final StringBuilder sb) {
		return getSecondArg().appendTo(getOperator().appendTo(getFirstArg().appendTo(sb)));
	}

	public T getSecondArg() {
		return secondArg;
	}

	public void setSecondArg(final T secondArg) {
		this.secondArg = secondArg;
	}

	public O getOperator() {
		return operator;
	}

	public void setOperator(final O operator) {
		this.operator = operator;
	}

	public T getFirstArg() {
		return firstArg;
	}

	public void setFirstArg(final T firstArg) {
		this.firstArg = firstArg;
	}
}